<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>代理数</title>
<%@ include file="/pages/common/header.jsp" %>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/datePicker/WdatePicker.js"></script>
<script type="text/javascript">
$(function(){
	$("#btn1").bind('click',function(){
		var date=$("#date").val();
		var flightDate=$("#flightDate").val();
		var fromCity=$("#fromCity").val();
		var toCity=$("#toCity").val();
		
		$("#wait").show();
		$("#btn1").attr("disabled","true");
		var url ="<%=request.getContextPath() %>"+"/preprocess-AgentCount-agentCount.action";
		var data ={"date":date,"flightDate":flightDate,"fromCity":fromCity,"toCity":toCity};
		 $.ajax({
				url:url,
				data:data,
				type : "POST",
				cache : false, 
				async : true,
			    dataType:'json',
			    beforeSend:function(){
			    },
			    success:function(data){
			    	alert("代理数查询成功！");
			    	
			    	$("#tables").html('');
			    	$.each( data.count, function(key, value){
			    		$("#tables").append("<h1>"+key+"</h1><br>");
			    		$("#tables").append("<table>");
			    		$.each( value, function(id, e){
			    			$("#tables").append("<tr><td>"+id+"</td><td>"+e+"</td></tr>");
			    		});
			    		$("#tables").append("</table><br>");
			    	});
			    	$("#btn1").removeAttr("disabled");
			    	$("#wait").hide();
			    },
			    error:function(){
			    	alert("代理数查询失败！，请联系管理员！");
			    	$("#btn1").removeAttr("disabled");
			    	$("#wait").hide();
			    	},
			    	
			    complete:function(){ 
			    	$("#btn1").removeAttr("disabled");
			    	$("#wait").hide();
			    }
			});
		
	});
});

</script>
</head>
<body>
<div class="searchtitle" style="width :1100px;">
	<div class="navbar"><div class="navbar-l"></div><div class="navbar-r"></div>
	        <div class="navbar-inner"> 
	        <b>代理数查询</b> 
	        </div>
	 </div>
	 <table cellSpacing=0 cellPadding=0  border=0 class="form2column">
			<tr  >
				<td class="label"> 开始日期：</td>
				<td class="" style="width:250px;">
					<input name="date" type="text"	id="date" style="width: 180px"    
								onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly"/>
				</td>
				<td class="label"> 航班时间：</td>
				<td class="" style="width:250px;">
					<input name="flightDate" type="text"	id="flightDate" style="width: 180px"    
								onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly"/>
				</td>
			</tr>
			<tr>
				<td class="label"> 出发城市：</td>
				<td class="" style="width:250px;">
					<input name="fromCity" type="text"	id="fromCity" style="width: 180px" value="PEK"/>
				</td>
				<td class="label"> 到达城市：</td>
				<td class="" style="width:250px;">
					<input name="toCity" type="text"	id="toCity" style="width: 180px" value="CAN"/>
				</td>
			</tr>
		
		<tr>
			 <td colspan="4"  style="text-align:center;height:35px;" >
	           <input type="button" value="确定" id="btn1" class="btn-normal"/>
	         </td>
		</tr>
		
	 </table>
	 <div  id="wait" style="display:none; text-align:center;" >
		<span ><font color="red"> 正在处理中，请耐心等候...</font></span>
	</div>
	<div id="tables"></div>
</div>
</body>
</html>